package com.yehongyu.mytools.basic.grammar;

public class Java006_OverrideEquals {
	private int x, y;

	public Java006_OverrideEquals(int x, int y) {
		this.x = x;
		this.y = y;
	}

	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (!(obj instanceof Java006_OverrideEquals))
			return false;
		return (this.x == ((Java006_OverrideEquals) obj).x)
				&& (this.y == ((Java006_OverrideEquals) obj).y);
	}

	public static void main(String[] args) {
		Object objA = new Java006_OverrideEquals(1, 2);
		Object objB = new Java006_OverrideEquals(1, 2);
		System.out.println(objA.equals(objB));
	}
}
